#include "vofa.h"
#include "main.h"
#include "cntl_algorithm.h"
uint8_t cntl_upload_switch = 0;
extern MOTOR pmsm;
extern DMA_HandleTypeDef hdma_usart1_tx;
extern UART_HandleTypeDef huart1;

void cntl_upload(void)                                //这个是切换显示通道的函数
{
    if (BOARD_UPLOAD_REMAIN_SIZE == 0) {              //DMA剩余要发送的数据为0, 才可以切换
        switch (cntl_upload_switch) {
        default:
        case 0:
            board_upload_buff.fdata[0] = pmsm.currA;
            board_upload_buff.fdata[1] = 0;
            board_upload_buff.fdata[2] = pmsm.theta;
            break;
        case 1:
            board_upload_buff.fdata[0] = 0;
            board_upload_buff.fdata[1] = 0;
            board_upload_buff.fdata[2] = 0;
            break;
        }
        BOARD_UploadStart();　　　　　　　　　　　　　　//没发完，本次中断不发送
    }
}
Frame_t board_upload_buff;
void BOARD_UploadStart(void)
{
    HAL_UART_Transmit_DMA(&huart1, (uint8_t *)&board_upload_buff, sizeof(Frame_t));　　//发送结构体(不用对float做处理了)
}
 